# -*- coding: utf8 -*-

import os
import sys
reload(sys) 
sys.setdefaultencoding('utf8')
import caller
import webkit
import webpage
import webelement
import time
import caller

gconfig = caller.GlobalConfig()
gconfig.init("10.58.222.103:2181")

wk = webkit.WebKit("test")
page = wk.getWebPage("http://list.jd.com/list.html?cat=670,677,5009", 30000, 40000)

if page is None:
    _exit(0)

print "Get success."

time.sleep(5)

if page.waitForCssSelector("div.m>div.pagin>a.next", 100):
    e = page.getElementByCssSelector("div.m>div.pagin>a.next")
    print e.getOuterXml()
    print e.getAttribute("href")
else:
   print "Can't get : div.m>div.pagin>a.next"

page.destroy(True)
